package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Vomapper {
    @Select("select  sum(amount) from order_info where  date(create_time)='2023-01-06'")
    Double getlist1();
@Select("call chu()")
    List<Vo> getlist2();
@Select("select bo.org_name 'name',sum(tt.actual_distance) 'licen',\n" +
        "       count(tt.id) 'num' , sum(timestampdiff(second ,tt.actual_start_time,tt.actual_end_time)) 'num2',\n" +
        "       sum(timestampdiff(second ,tt.actual_start_time,tt.actual_end_time))/count(tt.id) 'avg1',\n" +
        "       sum(tt.actual_distance)/count(tt.id) 'avg2',\n" +
        "       rank() over (order by count(tt.id) desc)\n" +
        "from transport_task tt\n" +
        "left join line_base_info lbi on lbi.id = tt.line_id\n" +
        "left join base_organ bo on bo.id = lbi.org_id\n" +
        "group by bo.org_name")
    List<Vo1> getlist3();
@Select("select  b.name 'name',count(t.id) 'value'from transport_task_detail t\n" +
        "left join transport_task tt on tt.id = t.transport_task_id\n" +
        "left join line_base_info lbi on lbi.id = tt.line_id\n" +
        "left join base_organ bo on bo.id = lbi.org_id\n" +
        "left join base_region_info bri on bri.id = bo.region_id\n" +
        "left join base_region_info b on b.id = bri.parent_id\n" +
        "group by b.name")
    List<Vo> getlist4();
}
